<%--
  Created by IntelliJ IDEA.
  User: 11639
  Date: 2023/4/14
  Time: 21:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div id="page_nav">
    <c:if test="${requestScope.bookPage.pageNo>1}">
    <a href="${requestScope.bookPage.url}&pageNo=1&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">首页</a>
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageNo-1}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">上一页</a>
    </c:if>


    <c:if test="${requestScope.bookPage.pageNo-2>=1}">
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageNo-2}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">${requestScope.bookPage.pageNo-2}</a>
    </c:if>
    <c:if test="${requestScope.bookPage.pageNo-1>=1}">
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageNo-1}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">${requestScope.bookPage.pageNo-1}</a>
    </c:if>
    【${requestScope.bookPage.pageNo}】
    <c:if test="${requestScope.bookPage.pageNo+1<=requestScope.bookPage.pageTotal}">
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageNo+1}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">${requestScope.bookPage.pageNo+1}</a>
    </c:if>
    <c:if test="${requestScope.bookPage.pageNo+2<=requestScope.bookPage.pageTotal}">
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageNo+2}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">${requestScope.bookPage.pageNo+2}</a>
    </c:if>


    <c:if test="${requestScope.bookPage.pageNo<requestScope.bookPage.pageTotal}">
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageNo+1}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">下一页</a>
    <a href="${requestScope.bookPage.url}&pageNo=${requestScope.bookPage.pageTotal}&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}">末页</a>
    </c:if>

    共${requestScope.bookPage.pageTotal}页，${requestScope.bookPage.pageTotalCount}条记录
    到第<input value="${requestScope.bookPage.pageNo}" name="pn" id="pn_input"/>页
    <input id="searchPageBtn" type="button" value="确定">

    <script type="text/javascript">
        $(function () {
            // 跳到指定的页码
            $("#searchPageBtn").click(function () {

                var pageNo = $("#pn_input").val();
                if(pageNo>${requestScope.bookPage.pageTotal}||pageNo<1){
                    pageNo=1;
                }
                <%--var pageTotal = ${requestScope.page.pageTotal};--%>
                <%--alert(pageTotal);--%>
                // javaScript 语言中提供了一个 location 地址栏对象
                // 它有一个属性叫 href. 它可以获取浏览器地址栏中的地址
                // href 属性可读，可写

                location.href = "${pageScope.basePath}${requestScope.bookPage.url}&pageNo="+pageNo+"&minPrice=${param.minPrice}&maxPrice=${param.maxPrice}";
            });
        });
    </script>
</div>